<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  <style type="text/css">
    .active {
      border: 1px solid red;
      width: 100px;
      height: 100px;
    }
    .error {
      background-color: orange;
    }
    .test {
      color: blue;
    }
    .base {
      font-size: 25px;
    }
  </style>
  </head>
  <body>
    <div class="" id="app">
      <div v-bind:class="[activeClass, errorClass, {test: isTest}]">测试样式</div>
      <div v-bind:class="arrClasses"></div>
      <div v-bind:class="objClasses"></div>
      <div class="base" v-bind:class="objClasses">测试样式</div>
      <button v-on:click="handle">切换</button>
    </div>

    <script type="text/javascript" src="js/vue.js"></script>
    <script type="text/javascript">
      var vm = new Vue({
        el: "#app",
        data: {
          activeClass: "active",
          errorClass: "error",
          isTest: true,
          arrClasses: ["active", "error"],
          objClasses: {
            active: true,
            error: true,
          },
        },
        methods: {
        	handle: function (argument) {
        		// 无法切换回去
        		this.activeClass = "";
        		this.errorClass = "";
        		this.isTest = false;
        		this.objClasses.error = false;
        	}
        },
      });
    </script>
  </body>
</html>
